﻿<div class="main">

<form method = "post" action= "articlesList.php?type=<?= $_GET['type'] ?>" class ="pullLeft">
	<span><label for = "sort">Trier Par : </label></span>
	<select name = "sort">
		<option value = "date" <?php if($sortLA == "date"){echo('selected');} ?> >Date</option>
		<option value = "autorID" <?php if($sortLA == "autorID"){echo('selected');} ?> >Auteur</option>
		<option value = "title" <?php if($sortLA == "title"){echo('selected');} ?> >Titre</option>
		<option value = "note" <?php if($sortLA == "note"){echo('selected');} ?> >Note</option>
	</select>
	<select name = "order">
		<option value = "ASC" <?php if($orderLA == "ASC"){echo('selected');} ?> >Croissant</option>
		<option value = "DESC"<?php if($orderLA == "DESC"){echo('selected');} ?> >Décroissant</option>
	</select>
	<button type = "submit" name ="allArtsSortPost" >Ok</button>
</form>
<?php
if (isset($res_artsList)) {
    while ($row_artsList = mysqli_fetch_array($res_artsList)) { ?>
    <div class="list-article clearfix">
		<?php if(isset($row_artsList['link']) && $row_artsList['imgStatus'] != 3) { ?>
				<img src="<?= imgLink($row_artsList['link']) ?>" />
		<?php } else { ?>
				<img src="<?= imgLink("img/blockedImg.png") ?>" />
		<?php }?>
        <div>
            <div class="clearfix">
                <h2 class="pull-left"><a href="<?= WEBROOT ?>article/article.php?id=<?= $row_artsList['id'] ?>" title="<?= $row_artsList['title'] ?>"><?php if(isset($row_artsList['title'])) { echo $row_artsList['title']; } ?></a></h2>
                <div class="note pull-right">
                    <?= colorNote($row_artsList['note']) ?>
                </div>
            </div>
            <div>
                <a href="<?= WEBROOT ?>user/user.php?id=<?= $row_artsList['autorID'] ?>"><?php if(isset($row_artsList['autor'])) { echo $row_artsList['autor']; } ?></a>
                <span>&emsp;&mdash;&emsp;</span>
                <?php if(isset($row_artsList['date'])) { echo strftime("le %d %B %Y à %H:%M:%S",strtotime($row_artsList['date'])); } ?>
                <span>&emsp;&mdash;&emsp;</span>
                <?php if(isset($row_artsList['type'])) { echo $row_artsList['type']; } ?>
            </div>
            <p><?php if(isset($row_artsList['content'])) { echo substr($row_artsList['content'], 0, 200)."..."; } ?></p>

        </div>
    </div>

<?php }
 } ?>

</div>